Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rdlc.rdl
Class Namespace

    java.lang.Object
      rdlc.naming.Catalog<java.lang.String,V>
          rdlc.naming.HierarchicalCatalog<Declaration>
              rdlc.rdl.Namespace

All Implemented Interfaces:
  Declaration, Expression

    public class Namespace

extends HierarchicalCatalog<Declaration>
implements Declaration

`Namespace` provides a direct representation of an RDL namespace declaration. This class is not only responsible for bindings and managing sub-declarations, but also for late binding of declarations and then statics. This ensures that all static identifiers are bound before they are referenced.

Version:
  $Revision: 1.21 $
Author:
  Greg Gibeling

Nested Class Summary
`protected static class` | `Namespace.Accessor` Accessor class for namespaces.
`static class` | `Namespace.Identifier` Identifier for namespaces.
`protected static class` | `Namespace.LateBindDecl` LateBindDecl holds a declaration and it raw static identifier for later binding into a namespace.
`static class` | `Namespace.QualifiedIdentifier` Qualified identifier for declarations.

Nested classes/interfaces inherited from class rdlc.naming.HierarchicalCatalog
`HierarchicalCatalog.DefaultAccessor<_V>`

Nested classes/interfaces inherited from interface rdlc.rdl.Expression
`Expression.Phase`

Field Summary
`protected Expression.Phase` | `bound` Records whether or not we have bound all of the decls.
`protected java.util.List<Namespace.LateBindDecl>` | `lateBindDeclList` A list of declarations to late bind.
`protected Expression.Phase` | `resolved` A flag to prevent us from trying to resolve the statics in this namespace twice.

Fields inherited from class rdlc.naming.HierarchicalCatalog
`cachedIdentifier, cachedRoot, name, parent`

Fields inherited from class rdlc.naming.Catalog
`entryList, indexTable`

Constructor Summary
`Namespace(RawStaticIdentifier rawStaticID)` Create a namespace named by the given static identifier.
`Namespace(java.lang.String _name)` Create a namespace with no parent, and the given name.

Method Summary
`void` | `add(Declaration_Named _declNamed)` Add the given named declaration to this namespace.
`void` | `add(Namespace _namespace)` Add the given namespace as a child of this namespace.
`protected void` | `bindDecls(Log errorLog, Expression.Phase phase)` Bind all of the non-namespace declarations which have been added with `add(Declaration_Named)`.
`static Namespace` | `create(Namespace start, Identifier identifier)` Create a the tree of namespaces required to get to the location named by the given identifier.
`Namespace.Identifier` | `createIdentifier(java.util.List<java.lang.String> lName, Log errorLog)` Create a static identifier which names a declaration from a list of strings.
`Declaration` | `getBase()` Simple accessor.
`java.lang.String` | `getLambdaName()` Simple accessor.
`Declaration` | `getNamedBase()` Simple accessor.
`void` | `getRequirements(CatalogSet<Identifier<Declaration>> requirements)` Generate a list of the declarations upon which this one relies.
`Declaration` | `getType()` Simple accessor.
`void` | `resolve(java.util.HashSet<Declaration> markSet, Log errorLog, Expression.Phase phase)` Firsts make sure all of the declarations in all of the children namespaces are bound, and then resolve them.
`void` | `setNamespace(Namespace _namespace)` Simple accessor.
`void` | `setRawStaticID(RawStaticIdentifier rawStaticID)` Simple accessor.
`java.lang.String` | `toString()` Simple accessor.
`boolean` | `typeMatch(Expression e)` Two namespaces will never type match.

Methods inherited from class rdlc.naming.HierarchicalCatalog
`connectParent, getIdentifier, getName, getParent, getRoot, hashCode`

Methods inherited from class rdlc.naming.Catalog
`clear, containsKey, entryList, get, get, getKey, isEmpty, keySet, put, put, putAll, remove, size`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface rdlc.rdl.Declaration
`getIdentifier`

Field Detail

### resolved

    protected Expression.Phase resolved

  A flag to prevent us from trying to resolve the statics in this namespace twice. Basically to save us a lot of potentially wasted cycles.

### lateBindDeclList

    protected java.util.List<Namespace.LateBindDecl> lateBindDeclList

  A list of declarations to late bind. These are bound before the statics are resolved but after the namespaces.

### bound

    protected Expression.Phase bound

  Records whether or not we have bound all of the decls. Meant to save redoing a lot of work.

Constructor Detail

### Namespace

    public Namespace(java.lang.String _name)

  Create a namespace with no parent, and the given name.

  Parameters:
    `_name` - The name to give this new namespace.

### Namespace

    public Namespace(RawStaticIdentifier rawStaticID)

  Create a namespace named by the given static identifier. This is used during include parsing.

  Parameters:
    `rawStaticID` - The raw static identifier to use as this namespaces name.

Method Detail

### create

    public static Namespace create(Namespace start,
                                   Identifier identifier)

  Create a the tree of namespaces required to get to the location named by the given identifier. This is used when we have an identifier for a declaration we wish to create, but we need to ensure that all the namespaces leading to it are created. Note that this will not create the declaration named by that identifier, merely the namespace it is contained in, and all of that namespace's parents.

  Parameters:
    `start` - Any namespace in the existing hierarchy.
    `identifier` - The identifier for the declaration we want to create.
  Returns:
    The namespace in which the declaration named by `identifier` should be bound.

### toString

    public java.lang.String toString()

  Simple accessor.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A human readable string representation of this instance for debugging.

### add

    public void add(Declaration_Named _declNamed)

  Add the given named declaration to this namespace. For a namespace which has not been resolved this will add it to the late binding list for binding during `resolve()`. Whereas for a namespace which has already been resolved this will add the declaration directly in. In both cases it will call `setNamespace` as appropriate.

  Parameters:
    `_declNamed` - The named declaration being added to this namespace.
  See Also:
    `Expression.resolve(HashSet, Log, Phase)`, `Declaration_Named.setNamespace(Namespace)`

### add

    public void add(Namespace _namespace)

  Add the given namespace as a child of this namespace. Note that this is much simpler than `add(Declaration_Named)`.

  Parameters:
    `_namespace` - The namespace to add to this one.

### setRawStaticID

    public void setRawStaticID(RawStaticIdentifier rawStaticID)

  Simple accessor. Used during normal parsing. Note that this method will also update the `HierarchicalCatalog.cachedIdentifier` field as appropriate.

  Specified by:
    `setRawStaticID` in interface `Declaration`
  Parameters:
    `rawStaticID` - Set the raw static identifier with which this declaration is declared.

### setNamespace

    public void setNamespace(Namespace _namespace)

  Simple accessor. Used during normal parsing. Note that this also takes care of regenerating the identifier as required, and updating the namespace in which all of this namespace's declarations exist. This is necessary to update the appropriate identifiers.

  Specified by:
    `setNamespace` in interface `Expression`
  Parameters:
    `_namespace` - The namespace in which this namespace was declared.

### bindDecls

    protected void bindDecls(Log errorLog,
                             Expression.Phase phase)

  Bind all of the non-namespace declarations which have been added with `add(Declaration_Named)`. All this method does is iterate over `lateBindDeclList` and `bind()` them.

  Parameters:
    `errorLog` - A list of all the errors to be reported.
    `phase` - The phase of resolution to perform.
  See Also:
    `Namespace.LateBindDecl#bind(Namespace, Log, Phase)`

### resolve

    public void resolve(java.util.HashSet<Declaration> markSet,
                        Log errorLog,
                        Expression.Phase phase)

  Firsts make sure all of the declarations in all of the children namespaces are bound, and then resolve them. Notice that the way this is structured, the recursion of `bindDecls()` will ensure that ALL declarations in ALL namespaces are bound before ANY are resolved.

  Specified by:
    `resolve` in interface `Expression`
  Parameters:
    `markSet` - Complete hash set of expressions on which the caller depends (including itself).
    `errorLog` - A list of all the errors to be reported.
    `phase` - The phase of resolution to perform.

### typeMatch

    public boolean typeMatch(Expression e)

  Two namespaces will never type match.

  Specified by:
    `typeMatch` in interface `Expression`
  Parameters:
    `e` - The expression to check this one against.
  Returns:
    `false`

### getBase

    public Declaration getBase()

  Simple accessor.

  Specified by:
    `getBase` in interface `Declaration`
  Returns:
    Always `this`.

### getNamedBase

    public Declaration getNamedBase()

  Simple accessor.

  Specified by:
    `getNamedBase` in interface `Declaration`
  Returns:
    Always `this`.
  See Also:
    `Declaration.getBase()`

### getLambdaName

    public java.lang.String getLambdaName()

  Simple accessor.

  Specified by:
    `getLambdaName` in interface `Declaration`
  Returns:
    Always the name of this namespace, since namespaces are always named.

### getType

    public Declaration getType()

  Simple accessor.

  Specified by:
    `getType` in interface `Declaration`
  Returns:
    Always `this`.

### getRequirements

    public void getRequirements(CatalogSet<Identifier<Declaration>> requirements)

  Description copied from interface: `Expression`
  Generate a list of the declarations upon which this one relies. This includes all the namespaces in which this declaration is bound, and all of the declarations referenced by this declaration. Used for pruning the amount of work done during output.

  Specified by:
    `getRequirements` in interface `Expression`
  Parameters:
    `requirements` - A list to which this will add the declarations upon which this one relies.
  See Also:
    `Expression.getRequirements(CatalogSet)`

### createIdentifier

    public Namespace.Identifier createIdentifier(java.util.List<java.lang.String> lName,
                                                 Log errorLog)

  Create a static identifier which names a declaration from a list of strings. This can be used to turn a command line typed string into a full static identifier which can then be dereferenced to get a declaration.

  Parameters:
    `lName` - A list of strings to turned into a fully qualified static identifier.
    `errorLog` - A log to add all the errors to.
  Returns:
    A static identifier.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD